package com.eusoft.demo.utils;

import com.eusoft.demo.entity.Result;
import com.eusoft.demo.enums.ResultEnum;

/**
 * @authoe DevMing
 * @data 2021/8/19 10:45
 */
public class ResultUtil {

    public static Result success(Object data) {
        Result result = new Result();
        result.setCode(ResultEnum.SUCCESS.getCode());
        result.setMessage(ResultEnum.SUCCESS.getMessage());
        result.setData(data);
        return result;
    }

    public static Result error(Integer code, String message) {
        Result result = new Result();
        result.setCode(code);
        result.setMessage(message);
        result.setData(null);
        return result;
    }
}
